﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Firefly.Libs;

namespace Ether
{
    public abstract class Camera : GameComponent
    {
        //Fields
        public Vector3 CameraPosition;
        public Vector3 CameraTarget;

        protected float FoV;
        protected float nearPlane;
        protected float farPlane;

        public Matrix Projection
        {
            get
            {
                return Matrix.CreatePerspectiveFieldOfView(FoV, Game.GraphicsDevice.Viewport.AspectRatio, nearPlane, farPlane);
            }
        }
        public Matrix View
        {
            get
            {
                return Matrix.CreateLookAt(CameraPosition, CameraTarget, Vector3.Up);
            }
        }

        //Construct
        public Camera(Game game, Vector3 Start, Vector3 Lookat)
            : base(game)
        {
            CameraPosition = Start;
            CameraTarget = Lookat;
            FoV = MathHelper.PiOver4;
            nearPlane = 1f;
            farPlane = 300f;
        }

        //Methods               
        public abstract void UpdateCamera(Input input);
    }
}
